const mapObjUtil={
    map(from,to){
        let to_copy={...to};
        if(!from)throw  Error("from is null or undefined");
        let fromKeys=Object.keys(from);
        let toKeys=Object.keys(to_copy);
        const FindFunc=(list,item)=>{
            if((typeof item)=="undefined")return -1;
            for (let index = 0; index < list.length; index++) {
                const element = list[index];
                if(element  && element.toString().toLowerCase()==item.toString().toLowerCase()){
                    return index;
                }
            }
            return -1;
        }
        for (let index = 0; index < fromKeys.length; index++) {
            const fromKey = fromKeys[index];
            let toKeyIndex= FindFunc(toKeys,fromKey);
            if(toKeyIndex>=0){
                let toKey= toKeys[toKeyIndex];
                to_copy[toKey]=from[fromKey];
            }
        }
        return to_copy;
    }
}
export default mapObjUtil;